package com.yxym.homework09;
//创建Teacher类，分别有该类属性和方法，通过构造器在创建对象时将其属性赋值
public class Teacher extends Person{
    private int work_age;

    public Teacher(String name, char sex, int age, int work_age) {
       super(name,sex,age);
        this.work_age = work_age;
    }

    public double getWork_age() {
        return work_age;
    }

    public void setWork_age(int work_age) {
        this.work_age = work_age;
    }
    public void teach(){
        System.out.println(getName() + "我承诺,我会好好教java");
    }

    @Override
    public String play() {
        return super.play() + "下象棋";
    }
    //输出信息方法
     /*
    姓名；....
    年龄；....
    性别；....

     */
    public void  printInfo(){
        System.out.println("教师信息" + "\n" + basicPrint());
        System.out.println("工龄：" + work_age);
        System.out.println(play());
    }

    @Override
    public String toString() {
        return "Teacher{" +
                "work_age=" + work_age +
                '}' + super.toString();
    }
}